package com.cf.r1027_e;

import java.io.*;

public class b {

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        int T = Integer.parseInt(br.readLine());
        while (T-- > 0) {
            solve();
        }
        out.flush();
        out.close();
        br.close();
    }

    static void solve() throws IOException {
        String[] ss = br.readLine().split(" ");
        int n = Integer.parseInt(ss[0]);
        int k = Integer.parseInt(ss[1]);
        char[] s = br.readLine().toCharArray();
        int c0 = 0;
        int c1;
        for (char c : s) {
            if (c == '0') c0++;
        }
        c1 = n - c0;

        int max = c0 / 2 + c1 / 2;
        int min = Math.abs(c0 - c1) / 2;

        if (k < min || k > max) {
            out.println("NO");
        } else if ((k % 2) != (max % 2)) {
            out.println("NO");
        } else {
            out.println("YES");
        }

    }
}
